/*************************************************************************
eGUI/easyGUI Copyright (c) 2007-2008 Xiao Wang Yang 
Author: Xiao Wang Yang
Email: sureone@gmail.com   
Project Site: http://code.google.com/p/easygui
------------------------------------------
Revision History:
2008-01-09			
	CCommonListWidget
*************************************************************************/

#pragma once
#include "common.h"
#include "Model.h"
#include "DisplayManage.h"
#include "Widget.h"
#include "Container.h"
#include "CBackgroundWidget.h"



class DLL_EXP CCommonListWidget : public CContainerWidget
{
public:
	int m_nItem;
	int m_nSeparateDx;
	int m_nOffsetTop;
	int m_nItemWidth;
	int m_nItemHeight;
	
	CContainerWidget m_listContainer;
	CBackGroundWidget m_bkWidget;
	CWidget* m_pFocusItem;
	CWidget* m_pLastItem;
	CWidget* m_pSelectedItem;
	
	CCommonListWidget(void);
	virtual bool Scroll(int dx,int dy);
	CWidget* GetSelectedItem();
	virtual ~CCommonListWidget(void);
	virtual bool AddItem(CWidget* pWidget,int nIndex=-1);
	virtual int SetRect(WRect* pRect,bool bNoDraw=true);
	CWidget* GetItem(WPoint* pt);
public:
	virtual bool IsContinueWhileOutView(CWidget* pWidget);
	virtual void HandleItemSelected(CWidget* pLastItem,CWidget* pCurItem);
	virtual void ReCalLayout(bool bInitial=false);

};